<%@page import="cn.jhc.dao.NewMsgDAO"%>
<%@page import="cn.jhc.dao.MusicDAO"%>
<%@page import="cn.jhc.dao.ActDAO"%>
<%@page import="cn.jhc.bean.MsgBean"%>
<%@page import="cn.jhc.dao.MsgDao"%>
<%@page import="java.util.ArrayList"%>
<%@page import="cn.jhc.bean.NewsBean"%>
<%@page import="java.util.List"%>
<%@page import="cn.jhc.dao.ConnectionFactory"%>
<%@page import="cn.jhc.dao.NewsDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="./css/news.css"></link>
<style>
* {
	border: 0;
}
table tr:hover {
}
</style>
<title>校园新闻</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="./header.jsp"></jsp:include>
		<div id="address">
			<a>当前位置： 新闻中心</a>
		</div>
		<div id="wrapperdown">
			<%
				String id = request.getParameter("id");
				int Id = Integer.parseInt(id);
				NewsDAO dao = new NewsDAO();
				dao.setCon(ConnectionFactory.getConnection());
				NewsBean list = dao.getContext(Id);
				request.setAttribute("news", list);
			%>
			<div id="all_title">
							<div id="topright2">
								<div id="righttop">
									<a>讨论区最新主题</a>
								</div>
								<div id="right_down">
									<%
										ArrayList<MsgBean> m = new ArrayList<MsgBean>();
										MsgDao water = new MsgDao();
										water.setCon(ConnectionFactory.getConnection());
										m = water.getAllMessages(1, 4);
										request.setAttribute("water", m);
									%>
									<%
										ArrayList<MsgBean> a = new ArrayList<MsgBean>();
										ActDAO act = new ActDAO();
										act.setCon(ConnectionFactory.getConnection());
										a = act.getAllMessages(1, 4);
										request.setAttribute("act", a);
									%>
									<%
										ArrayList<MsgBean> b = new ArrayList<MsgBean>();
										MusicDAO music = new MusicDAO();
										music.setCon(ConnectionFactory.getConnection());
										b = music.getAllMessages(1, 4);
										request.setAttribute("music", b);
									%>
									<%
										ArrayList<MsgBean> n = new ArrayList<MsgBean>();
										NewMsgDAO NewMsg = new NewMsgDAO();
										NewMsg.setCon(ConnectionFactory.getConnection());
										n = NewMsg.getAllMessages(1, 4);
										request.setAttribute("News", n);
									%>
									<table width="280" align="left">
										<c:forEach items="${requestScope.water}" var="water">
											<tr>
												<td height="30"><div id="alltitle">
														<img src="images/face.gif"></img><a
															href="showmessages.jsp?id=${water.id}">[灌水区]${water.title}</a>
													</div></td>
											</tr>
										</c:forEach>
										<c:forEach items="${requestScope.act}" var="act">
											<tr>
												<td height="30"><div id="alltitle">
														<img src="images/face.gif"></img><a
															href="showActmessages.jsp?id=${act.id}">[活动专区]${act.title}</a>
													</div></td>
											</tr>
										</c:forEach>
										<c:forEach items="${requestScope.music}" var="music">
											<tr>
												<td height="30"><div id="alltitle">
														<img src="images/face.gif"></img><a
															href="showMusicmessages.jsp?id=${music.id}">[音乐专区]${music.title}</a>
													</div></td>
											</tr>
										</c:forEach>
										<c:forEach items="${requestScope.News}" var="News">
											<tr>
												<td height="30"><div id="alltitle">
														<img src="images/face.gif"></img><a
															href="showNewsmessages.jsp?id=${News.id}">[新闻讨论区]${News.title}</a>
													</div></td>
											</tr>
										</c:forEach>
									</table>
									<div id="entertaolunqu">
										<a href="alltaolunqu.jsp">点此进入讨论区>></a>
									</div>
								</div>
							</div>
						<div id="newscontext2" align="center">
							<div id="newsaddress" align="left">
								<a>首页>新闻中心>详细信息</a>
							</div>
							<div id="text2">
								<a>${requestScope.news.title}</a>
							</div>
							<div id="date2">
								<a>发布时间：${requestScope.news.date}</a> <a>|</a> <a>来源：信息学院</a>
							</div>
							<div id="context">
								<p>${requestScope.news.context}</p>
							</div>
							<div id="end" align="right">
								<a>[END]</a>
							</div>
						</div>
			</div>
			
		</div>
		<div id="pagebg"></div>
		<div id="line2"></div>
		<div id="copyright">
			<a>版权所有:蓝调吉他社 </a><a>| </a>
			<div id="admin">
				<a href="houtai_index.jsp">管理员登录</a>
			</div>
		</div>
	</div>
</body>
</html>
